import 'package:date_format/date_format.dart';
import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:kunlun_gas/app_files.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    PatrolSignInViewState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    appBar: myAppBar(viewService.context, title: '拍照签到'),
    backgroundColor: Colors.white,
    body: Column(
      children: [
        Container(
          margin: EdgeInsets.only(top: 26, left: 16, right: 16),
          width: double.infinity,
          height: (ScreenUtil.screenHeightDp - 150) / 2,
          color: Color(0xffE2E2E2),
          child: MyInkWellWidget(
            child: state.selectImage != null
                ?    Container(
              width: double.infinity,
              height: double.infinity,
              child: Image.file(
                state.selectImage,
                fit: BoxFit.fill,
              ),
            )
                : Align(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Image.asset('images/camera_sigin.png'),
                        Padding(
                          padding: EdgeInsets.only(top: 18),
                          child: Text(
                            '添加图片',
                            style: TextThemeConfig.Font16WithColor66,
                          ),
                        )
                      ],
                    ),
                  ),
            onTap: () => dispatch(PatrolSignInViewActionCreator.onTapImage()),
          ),
        ),
        Container(
          margin: EdgeInsets.symmetric(horizontal: 15, vertical: 40),
          height: 50,
          decoration: BoxDecoration(
            color: ThemeConfig.mainColor,
            borderRadius: BorderRadius.all(Radius.circular(4)),
          ),
          child: InkWell(
            child: Align(
              child: Text(
                '提交',
                style: TextThemeConfig.Font16WithWhite,
              ),
            ),
            onTap: () => dispatch(PatrolSignInViewActionCreator.onSubmit()),
          ),
        ),
      ],
    ),
  );
}
